package ${servicePackage}.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import ${mapperPackage}.${pojo?replace("Tb","")}Mapper;
import ${pojoFullName};
import ${servicePackage}.${service};
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service
public class ${service}Impl extends BaseServiceImpl
<${pojo}> implements ${service} {

@Autowired
private ${pojo?replace("Tb","")}Mapper ${pojo?replace("Tb","")?lower_case}Mapper;

@Override
public PageInfo
<${pojo}> search(Integer pageNum, Integer pageSize,${pojo} ${pojo?replace("Tb","")?lower_case}) {
//设置分页
PageHelper.startPage(pageNum, pageSize);
//创建查询对象
Example example = new Example(${pojo}.class);

//创建查询条件对象
Example.Criteria criteria = example.createCriteria();

//模糊查询
/**if (StringUtils.isNotBlank(${pojo?replace("Tb","")?lower_case}.getNickName())) {
criteria.andLike("nickName", "%" + ${pojo?replace("Tb","")?lower_case}.getNickName() + "%");
}*/

List<${pojo}> list = ${pojo?replace("Tb","")?lower_case}Mapper.selectByExample(example);
return new PageInfo<>(list);
}
}
